package com.corpgovernment.organization.enumm;

import java.util.Arrays;

/**
 * 差旅类型
 */
public enum ProductTypeEnum {

    FLIGHT("flight", "机票"),
    TRAIN("train", "火车票");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    ProductTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ProductTypeEnum getByCode(String code) {
        return Arrays.stream(ProductTypeEnum.values()).filter(e -> code.equals(e.code)).findFirst().orElse(null);
    }
}
